#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "stm32f1xx_it.h"
#include "tim.h"
#include "usart.h"
#include "angle_upload.h"

//
// Created by yyc on 25-8-5.
//
uint8_t angle=0;
uint8_t TxBuf[32];
void angle_upload_init(void)
{
    HAL_TIM_Base_Start_IT(&htim2);
}

void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
    if(htim->Instance == TIM2)
    {
        sprintf((char*)TxBuf, "CUR:%d\n", angle);
        HAL_UART_Transmit_DMA(&huart1, TxBuf, strlen((char*)TxBuf));
    }
}